Gregor Slavec
Gregor Slavec

Reputation: 4904

Can modules be added to the Python search path (e.g site-packages dir) using symbolic links on Windows?

I tried to create a symbolic link in the Python site-packages directory using the mklink /D syntax (on a Windows 7 machine). Unfortunately the module is not found when using import clause. When I copy the module physicaly to site-package directory, it works OK. Am I doing something wrong or is this just not possible on Windows?

I am using Python 2.6.

Upvotes: 3

Views: 1716

Answers (1)

Apreche
Apreche

Reputation: 32869

I just did it on Windows 7 using Python 2.7, and it works. Here are the steps I followed.

  1. open a windows command prompt with necessary privileges
  2. cd to the site-packages directory

    cd c:\Python27\Lib\site-packages

  3. create the link

    mklink /D modulename c:\path\to\module\real\location\modulename

Upvotes: 1

Related Questions