如何解决virtualenv中的“太多级别的符号链接”错误?

时间:2019-04-23 06:02:07

标签: python django pip virtualenv

在Django Web应用程序框架中设置虚拟环境时出现错误(符号链接级别过多)。

我试图在堆栈溢出时查看以下问题和答案:

mkvirtualenv: Too many levels of symbolic links

virtualenv: Too many levels of symbolic links

 Kuldeeps-MacBook-Pro:trydjango kuldeep$ pip freeze

  branca==0.3.0
  certifi==2018.8.24
  chardet==3.0.4
  folium==0.6.0+11.g71ab988
  idna==2.7
  Jinja2==2.10
  MarkupSafe==1.0
  numpy==1.15.1
  requests==2.19.1
  six==1.11.0
  urllib3==1.23
  virtualenv==16.1.0

Kuldeeps-MacBook-Pro:trydjango kuldeep$ source bin/activate

(trydjango) Kuldeeps-MacBook-Pro:trydjango kuldeep$ ls

bin     db.sqlite3  include     lib     manage.py   src     trydjango

(trydjango) Kuldeeps-MacBook-Pro:trydjango kuldeep$ pip freeze

-bash: /Users/kuldeep/Dev/trydjango/bin/pip: /Users/kuldeep/Dev/trydjango/bin/python3: bad interpreter: Too many levels of symbolic links

ls -l对 bin 文件夹说:

drwxr-xr-x  3 kuldeep  staff    96 Mar 21 21:57 __pycache__ 
-rw-r--r--@ 1 kuldeep  staff  2087 Mar 31 20:19 activate
-rw-r--r--  1 kuldeep  staff  1114 Mar 21 21:56 activate.csh
-rw-r--r--  1 kuldeep  staff  2188 Mar 21 21:56 activate.fish
-rw-r--r--  1 kuldeep  staff  8321 Mar 21 21:56 activate.ps1
-rw-r--r--  1 kuldeep  staff  1143 Mar 21 21:56 activate_this.py
-rwxr-xr-x@ 1 kuldeep  staff   290 Mar 21 21:57 django-admin 
-rwxr-xr-x  1 kuldeep  staff   149 Mar 21 21:57 django-admin.py
-rwxr-xr-x  1 kuldeep  staff   258 Mar 31 20:08 easy_install
-rwxr-xr-x  1 kuldeep  staff   258 Mar 31 20:08 easy_install-3.7
-rwxr-xr-x  1 kuldeep  staff   240 Mar 31 20:08 pip
-rwxr-xr-x  1 kuldeep  staff   240 Mar 31 20:08 pip3 
-rwxr-xr-x  1 kuldeep  staff   240 Mar 31 20:08 pip3.7
lrwxr-xr-x  1 kuldeep  staff     9 Apr 23 10:55 python -> python3.7
-rwxr-xr-x  1 kuldeep  staff  2346 Mar 21 21:56 python-config
lrwxr-xr-x  1 kuldeep  staff     9 Apr 23 10:55 python3 -> python3.7
lrwxr-xr-x  1 kuldeep  staff     7 Mar 31 20:07 python3.7 -> python3
-rwxr-xr-x  1 kuldeep  staff   236 Mar 31 20:08 wheel

Snapshot of Terminal with -bash Error

1 个答案:

答案 0 :(得分:0)

这是问题所在

python3 -> python3.7
python3.7 -> python3

python3被符号链接到python3.7,但是python3.7被符号链接回到python3。这是symlink循环。

我建议删除并重新创建virtualenv。或者至少通过删除python3.7符号链接并将python3.7链接到实际的python3.7二进制文件来打破循环。